/*
 * @Description: 计算服务器消耗时长的中间件
 * @Author: zhihong deng
 * @Date: 2021-05-20 00:27:10
 * @LastEditors: zhihong deng
 * @LastEditTime: 2021-05-25 21:58:59
 */
module.exports = async (ctx,next) => {
    const start = Date.now()
    await next()
    const end = Date.now()
    const duration = end - start
    ctx.set('X-Response-Time',duration + 'ms')
}